<?php
/**
 * ������ ��� ������ � ����
 * 
 * @author Mazvv
 * @package Extenders
 */
class Menucontainer_model extends Model {
	
	public function __construct(){
		parent::Model();
		$this->db->query('set names \'utf8\'');	
	}
	
	/**
	 * �������� ������ ������� ���� ��� ���������
	 * 
	 * @author Mazvv
	 * @param $p_positionRid
	 * @return array
	 */
	public function GetMenusList($p_positionRid){
		$this->db->select('_positions_menus.rid, 
							_positions_menus.item_rights, 
							_positions_menus.item_area, 
							_positions_menus.parent, 
							_positions_menus.constant_search_rule,
							_positions_menus.default_sort_rule,
							_menu_items.item_name, 
							_menu_items.item_controller');
		$this->db->from('_positions_menus');
		$this->db->join('_menu_items', '_positions_menus._menu_items_rid = _menu_items.rid AND _menu_items.archive = 0');
		$this->db->where(array('_positions_menus._positions_rid'=>$p_positionRid, '_positions_menus.archive'=>0));
		$this->db->orderby('_menu_items.item_name');
		$query = $this->db->get();
		if($query->num_rows) {
			return $query->result();
		}
		return False;
	}
}
?>